]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupBaseMenuItem: Add support for Hidden Ornament
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Fri, 13 Sep 2019 15:59:16 +0000 (17:59 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Fri, 20 Sep 2019 15:53:42 +0000 (15:53 +0000)
The menu item ornament is used to put dots or checks in menus or otherwise
to define a padding for a label.
However in some cases we want to create a menu item with no left (in ltr)
padding.

In order to do that, define a HIDDEN Ornament mode that completely hides the
ornament actor.

The naming here might be confusing as this should probably be called NONE,
while the default mode is the invisible one, but it's too late to change it
now.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/720

js/ui/popupMenu.js

index e26771555b68086d9c14caa18b56fce63ffafdba..ad9b3c77c3b37b74eed48190fb3b034a079700a7 100644 (file)
@@ -15,6 +15,7 @@ var Ornament = {
     NONE: 0,
     DOT: 1,
     CHECK: 2,
+    HIDDEN: 3,
 };
 
 function isPopupMenuItemVisible(child) {
@@ -248,10 +249,12 @@ var PopupBaseMenuItem = GObject.registerClass({
         } else if (ornament == Ornament.CHECK) {
             this._ornamentLabel.text = '\u2713';
             this.add_accessible_state(Atk.StateType.CHECKED);
-        } else if (ornament == Ornament.NONE) {
+        } else if (ornament == Ornament.NONE || ornament == Ornament.HIDDEN) {
             this._ornamentLabel.text = '';
             this.remove_accessible_state(Atk.StateType.CHECKED);
         }
+
+        this._ornamentLabel.visible = ornament != Ornament.HIDDEN;
     }
 });